home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / finalizr.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  18KB  |  521 lines

  1. /***************************************************************************
  2.  
  3. Finalizer (GX523) (c) 1985 Konami
  4.  
  5. driver by Nicola Salmoria
  6.  
  7. ***************************************************************************/
  8.  
  9. #include "driver.h"
  10. #include "vidhrdw/generic.h"
  11. #include "cpu/m6809/m6809.h"
  12. #include "cpu/i8039/i8039.h"
  13.  
  14.  
  15. void konami1_decode(void);
  16.  
  17. extern unsigned char *finalizr_scroll;
  18. extern unsigned char *finalizr_videoram2,*finalizr_colorram2;
  19. static unsigned char *finalizr_interrupt_enable;
  20.  
  21. void finalizr_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  22. int finalizr_vh_start(void);
  23. void finalizr_vh_stop(void);
  24. WRITE_HANDLER( finalizr_videoctrl_w );
  25. void finalizr_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  26.  
  27.  
  28.  
  29. static int finalizr_interrupt(void)
  30. {
  31.     if (cpu_getiloops() == 0)
  32.     {
  33.         if (*finalizr_interrupt_enable & 2) return M6809_INT_IRQ;
  34.     }
  35.     else if (cpu_getiloops() % 2)
  36.     {
  37.         if (*finalizr_interrupt_enable & 1) return nmi_interrupt();
  38.     }
  39.     return ignore_interrupt();
  40. }
  41.  
  42. static WRITE_HANDLER( finalizr_coin_w )
  43. {
  44.     coin_counter_w(0,data & 0x01);
  45.     coin_counter_w(1,data & 0x02);
  46. }
  47.  
  48.  
  49. static int i8039_irqenable;
  50. static int i8039_status;
  51.  
  52. WRITE_HANDLER( finalizr_i8039_irq_w )
  53. {
  54.     if (i8039_irqenable)
  55.         cpu_cause_interrupt(1,I8039_EXT_INT);
  56. }
  57.  
  58. static READ_HANDLER( i8039_irqen_and_status_r )
  59. {
  60.     return i8039_status;
  61. }
  62.  
  63. static WRITE_HANDLER( i8039_irqen_and_status_w )
  64. {
  65.     i8039_irqenable = data & 0x80;
  66.     i8039_status = data;
  67. }
  68.  
  69.  
  70.  
  71. static struct MemoryReadAddress readmem[] =
  72. {
  73.     { 0x0800, 0x0800, input_port_5_r },
  74.     { 0x0808, 0x0808, input_port_4_r },
  75.     { 0x0810, 0x0810, input_port_0_r },
  76.     { 0x0811, 0x0811, input_port_1_r },
  77.     { 0x0812, 0x0812, input_port_2_r },
  78.     { 0x0813, 0x0813, input_port_3_r },
  79.     { 0x2000, 0x2fff, MRA_RAM },
  80.     { 0x3000, 0x3fff, MRA_RAM },
  81.     { 0x4000, 0xffff, MRA_ROM },
  82.     { -1 }    /* end of table */
  83. };
  84.  
  85. static struct MemoryWriteAddress writemem[] =
  86. {
  87.     { 0x0000, 0x0000, MWA_NOP },    /* ??? */
  88.     { 0x0001, 0x0001, MWA_RAM, &finalizr_scroll },
  89.     { 0x0002, 0x0002, MWA_NOP },    /* ??? */
  90.     { 0x0003, 0x0003, finalizr_videoctrl_w },
  91.     { 0x0004, 0x0004, MWA_RAM, &finalizr_interrupt_enable },
  92. //    { 0x0020, 0x003f, MWA_RAM, &finalizr_scroll },
  93.     { 0x0818, 0x0818, watchdog_reset_w },
  94.     { 0x0819, 0x0819, finalizr_coin_w },
  95.     { 0x081a, 0x081a, SN76496_0_w },    /* This address triggers the SN chip to read the data port. */
  96.     { 0x081b, 0x081b, MWA_NOP },        /* Loads the snd command into the snd latch */
  97.     { 0x081c, 0x081c, finalizr_i8039_irq_w },    /* custom sound chip */
  98.     { 0x081d, 0x081d, soundlatch_w },            /* custom sound chip */
  99.     { 0x2000, 0x23ff, colorram_w, &colorram },
  100.     { 0x2400, 0x27ff, videoram_w, &videoram, &videoram_size },
  101.     { 0x2800, 0x2bff, MWA_RAM, &finalizr_colorram2 },
  102.     { 0x2c00, 0x2fff, MWA_RAM, &finalizr_videoram2 },
  103.     { 0x3000, 0x31ff, MWA_RAM, &spriteram, &spriteram_size },
  104.     { 0x3200, 0x37ff, MWA_RAM },
  105.     { 0x3800, 0x39ff, MWA_RAM, &spriteram_2 },
  106.     { 0x3a00, 0x3fff, MWA_RAM },
  107.     { 0x4000, 0xffff, MWA_ROM },
  108.     { -1 }    /* end of table */
  109. };
  110.  
  111. static struct MemoryReadAddress i8039_readmem[] =
  112. {
  113.     { 0x0000, 0x0fff, MRA_ROM },
  114.     { -1 }    /* end of table */
  115. };
  116.  
  117. static struct MemoryWriteAddress i8039_writemem[] =
  118. {
  119.     { 0x0000, 0x0fff, MWA_ROM },
  120.     { -1 }    /* end of table */
  121. };
  122.  
  123. static struct IOReadPort i8039_readport[] =
  124. {
  125.     { 0x00, 0xff, soundlatch_r },
  126.     { I8039_p2, I8039_p2, i8039_irqen_and_status_r },
  127.     { 0x111,0x111, IORP_NOP },
  128.     { -1 }
  129. };
  130.  
  131. static struct IOWritePort i8039_writeport[] =
  132. {
  133.     { I8039_p1, I8039_p1, DAC_0_data_w },
  134.     { I8039_p2, I8039_p2, i8039_irqen_and_status_w },
  135.     { -1 }    /* end of table */
  136. };
  137.  
  138.  
  139.  
  140. INPUT_PORTS_START( finalizr )
  141.     PORT_START    /* IN2 */
  142.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  143.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  144.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  145.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  146.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  147.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  148.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  149.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )
  150.  
  151.     PORT_START    /* IN0 */
  152.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  153.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  154.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  155.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  156.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  157.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  158.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  159.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  160.  
  161.     PORT_START    /* IN1 */
  162.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  163.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  164.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  165.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  166.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  167.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  168.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  169.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  170.  
  171.     PORT_START    /* DSW */
  172.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
  173.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
  174.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  175.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  176.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
  177.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
  178.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  179.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
  180.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
  181.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  182.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
  183.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  184.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  185.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  186.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
  187.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
  188.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  189.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
  190.     PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
  191.     PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
  192.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  193.     PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
  194.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
  195.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  196.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
  197.     PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
  198.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  199.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
  200.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  201.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  202.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  203.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
  204.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
  205. /*     PORT_DIPSETTING(    0x00, "Invalid" ) */
  206.  
  207.     PORT_START    /* DSW */
  208.     PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
  209.     PORT_DIPSETTING(    0x03, "2" )
  210.     PORT_DIPSETTING(    0x02, "3" )
  211.     PORT_DIPSETTING(    0x01, "4" )
  212.     PORT_DIPSETTING(    0x00, "7" )
  213.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
  214.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  215.     PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
  216.     PORT_DIPNAME( 0x18, 0x18, DEF_STR( Bonus_Life ) )
  217.     PORT_DIPSETTING(    0x18, "30000 150000" )
  218.     PORT_DIPSETTING(    0x10, "50000 300000" )
  219.     PORT_DIPSETTING(    0x08, "30000" )
  220.     PORT_DIPSETTING(    0x00, "50000" )
  221.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
  222.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  223.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  224.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  225.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  226.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  227.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  228.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  229.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  230.  
  231.     PORT_START    /* DSW */
  232.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Flip_Screen ) )
  233.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  234.     PORT_DIPSETTING(    0x01, DEF_STR( On ) )
  235.     PORT_DIPNAME( 0x02, 0x02, "Controls" )
  236.     PORT_DIPSETTING(    0x02, "Single" )
  237.     PORT_DIPSETTING(    0x00, "Dual" )
  238.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
  239.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  240.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  241.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
  242.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  243.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  244.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )
  245. INPUT_PORTS_END
  246.  
  247. INPUT_PORTS_START( finalizb )
  248.     PORT_START    /* IN2 */
  249.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  250.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  251.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  252.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  253.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  254.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  255.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  256.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )
  257.  
  258.     PORT_START    /* IN0 */
  259.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  260.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  261.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  262.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  263.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  264.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  265.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  266.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  267.  
  268.     PORT_START    /* IN1 */
  269.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  270.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  271.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  272.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  273.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  274.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  275.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  276.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  277.  
  278.     PORT_START    /* DSW */
  279.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
  280.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
  281.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  282.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  283.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
  284.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
  285.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  286.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
  287.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
  288.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  289.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
  290.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  291.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  292.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  293.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
  294.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
  295.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  296.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
  297.     PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
  298.     PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
  299.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  300.     PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
  301.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
  302.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  303.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
  304.     PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
  305.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  306.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
  307.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  308.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  309.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  310.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
  311.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
  312. /*     PORT_DIPSETTING(    0x00, "Invalid" ) */
  313.  
  314.     PORT_START    /* DSW */
  315.     PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
  316.     PORT_DIPSETTING(    0x03, "2" )
  317.     PORT_DIPSETTING(    0x02, "3" )
  318.     PORT_DIPSETTING(    0x01, "4" )
  319.     PORT_DIPSETTING(    0x00, "7" )
  320.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
  321.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  322.     PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
  323.     PORT_DIPNAME( 0x18, 0x18, DEF_STR( Bonus_Life ) )
  324.     PORT_DIPSETTING(    0x18, "20000 100000" )
  325.     PORT_DIPSETTING(    0x10, "30000 150000" )
  326.     PORT_DIPSETTING(    0x08, "20000" )
  327.     PORT_DIPSETTING(    0x00, "30000" )
  328.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
  329.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  330.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  331.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  332.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  333.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  334.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  335.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  336.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  337.  
  338.     PORT_START    /* DSW */
  339.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Flip_Screen ) )
  340.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  341.     PORT_DIPSETTING(    0x01, DEF_STR( On ) )
  342.     PORT_DIPNAME( 0x02, 0x02, "Controls" )
  343.     PORT_DIPSETTING(    0x02, "Single" )
  344.     PORT_DIPSETTING(    0x00, "Dual" )
  345.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
  346.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  347.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  348.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
  349.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  350.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  351.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )
  352. INPUT_PORTS_END
  353.  
  354.  
  355.  
  356. static struct GfxLayout charlayout =
  357. {
  358.     8,8,    /* 8*8 characters */
  359.     4096,    /* 4096 characters */
  360.     4,    /* 4 bits per pixel */
  361.     { 0, 1, 2, 3 },    /* the four bitplanes are packed in one nibble */
  362.     { 0*4, 1*4, 0x10000*8+0*4, 0x10000*8+1*4, 2*4, 3*4, 0x10000*8+2*4, 0x10000*8+3*4 },
  363.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
  364.     16*8    /* every char takes 16 consecutive bytes */
  365. };
  366.  
  367. static struct GfxLayout spritelayout =
  368. {
  369.     16,16,    /* 16*16 sprites */
  370.     1024,    /* 1024 sprites */
  371.     4,    /* 4 bits per pixel */
  372.     { 0, 1, 2, 3 },    /* the four bitplanes are packed in one nibble */
  373.     { 0*4, 1*4, 0x10000*8+0*4, 0x10000*8+1*4, 2*4, 3*4, 0x10000*8+2*4, 0x10000*8+3*4,
  374.            16*8+0*4, 16*8+1*4, 16*8+0x10000*8+0*4, 16*8+0x10000*8+1*4, 16*8+2*4, 16*8+3*4, 16*8+0x10000*8+2*4, 16*8+0x10000*8+3*4 },
  375.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
  376.            16*16, 17*16, 18*16, 19*16, 20*16, 21*16, 22*16, 23*16 },
  377.     64*8    /* every sprite takes 64 consecutive bytes */
  378. };
  379.  
  380. static struct GfxDecodeInfo gfxdecodeinfo[] =
  381. {
  382.     { REGION_GFX1, 0, &charlayout,        0, 16 },
  383.     { REGION_GFX1, 0, &spritelayout,  16*16, 16 },
  384.     { REGION_GFX1, 0, &charlayout,    16*16, 16 },  /* to handle 8x8 sprites */
  385.     { -1 } /* end of array */
  386. };
  387.  
  388.  
  389.  
  390. static struct SN76496interface sn76496_interface =
  391. {
  392.     1,    /* 1 chip */
  393.     { 18432000/12 },    /* ?? */
  394.     { 75 }
  395. };
  396.  
  397. static struct DACinterface dac_interface =
  398. {
  399.     1,
  400.     { 75 }
  401. };
  402.  
  403.  
  404.  
  405. static struct MachineDriver machine_driver_finalizr =
  406. {
  407.     /* basic machine hardware */
  408.     {
  409.         {
  410.             CPU_M6809,
  411.             18432000/6,    /* ??? */
  412.             readmem,writemem,0,0,
  413.             finalizr_interrupt,16    /* 1 IRQ + 8 NMI (generated by a custom IC) */
  414.         },
  415.         {
  416.             CPU_I8039 | CPU_AUDIO_CPU,
  417.             5*18432000/15,    /* ??? */
  418.             i8039_readmem,i8039_writemem,i8039_readport,i8039_writeport,
  419.             ignore_interrupt,1
  420.         }
  421.     },
  422.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  423.     1,    /* single CPU, no need for interleaving */
  424.     0,
  425.  
  426.     /* video hardware */
  427.     36*8, 32*8, { 1*8, 35*8-1, 2*8, 30*8-1 },
  428.     gfxdecodeinfo,
  429.     32, 2*16*16,
  430.     finalizr_vh_convert_color_prom,
  431.  
  432.     VIDEO_TYPE_RASTER,
  433.     0,
  434.     finalizr_vh_start,
  435.     finalizr_vh_stop,
  436.     finalizr_vh_screenrefresh,
  437.  
  438.     /* sound hardware */
  439.     0,0,0,0,
  440.     {
  441.         {
  442.             SOUND_SN76496,
  443.             &sn76496_interface
  444.         },
  445.         {
  446.             SOUND_DAC,
  447.             &dac_interface
  448.         }
  449.     }
  450. };
  451.  
  452.  
  453.  
  454. /***************************************************************************
  455.  
  456.   Game driver(s)
  457.  
  458. ***************************************************************************/
  459.  
  460. ROM_START( finalizr )
  461.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  462.     ROM_LOAD( "523k01.9c",    0x4000, 0x4000, 0x716633cb )
  463.     ROM_LOAD( "523k02.12c",   0x8000, 0x4000, 0x1bccc696 )
  464.     ROM_LOAD( "523k03.13c",   0xc000, 0x4000, 0xc48927c6 )
  465.  
  466.     ROM_REGION( 0x1000, REGION_CPU2 )    /* 8039 */
  467.     ROM_LOAD( "d8749hd.bin",  0x0000, 0x0800, 0x978dfc33 )    /* this comes from the bootleg, */
  468.                                                             /* the original has a custom IC */
  469.  
  470.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  471.     ROM_LOAD( "523h04.5e",    0x00000, 0x4000, 0xc056d710 )
  472.     ROM_LOAD( "523h05.6e",    0x04000, 0x4000, 0xae0d0f76 )
  473.     ROM_LOAD( "523h06.7e",    0x08000, 0x4000, 0xd2db9689 )
  474.     /* 0c000-0ffff empty */
  475.     ROM_LOAD( "523h07.5f",    0x10000, 0x4000, 0x50e512ba )
  476.     ROM_LOAD( "523h08.6f",    0x14000, 0x4000, 0x79f44e17 )
  477.     ROM_LOAD( "523h09.7f",    0x18000, 0x4000, 0x8896dc85 )
  478.     /* 1c000-1ffff empty */
  479.  
  480.     ROM_REGION( 0x0240, REGION_PROMS )
  481.     ROM_LOAD( "523h10.2f",    0x0000, 0x0020, 0xec15dd15 ) /* palette */
  482.     ROM_LOAD( "523h11.3f",    0x0020, 0x0020, 0x54be2e83 ) /* palette */
  483.     ROM_LOAD( "523h12.10f",   0x0040, 0x0100, 0x53166a2a ) /* sprites */
  484.     ROM_LOAD( "523h13.11f",   0x0140, 0x0100, 0x4e0647a0 ) /* characters */
  485. ROM_END
  486.  
  487. ROM_START( finalizb )
  488.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  489.     ROM_LOAD( "finalizr.5",   0x4000, 0x8000, 0xa55e3f14 )
  490.     ROM_LOAD( "finalizr.6",   0xc000, 0x4000, 0xce177f6e )
  491.  
  492.     ROM_REGION( 0x1000, REGION_CPU2 )    /* 8039 */
  493.     ROM_LOAD( "d8749hd.bin",  0x0000, 0x0800, 0x978dfc33 )
  494.  
  495.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  496.     ROM_LOAD( "523h04.5e",    0x00000, 0x4000, 0xc056d710 )
  497.     ROM_LOAD( "523h05.6e",    0x04000, 0x4000, 0xae0d0f76 )
  498.     ROM_LOAD( "523h06.7e",    0x08000, 0x4000, 0xd2db9689 )
  499.     /* 0c000-0ffff empty */
  500.     ROM_LOAD( "523h07.5f",    0x10000, 0x4000, 0x50e512ba )
  501.     ROM_LOAD( "523h08.6f",    0x14000, 0x4000, 0x79f44e17 )
  502.     ROM_LOAD( "523h09.7f",    0x18000, 0x4000, 0x8896dc85 )
  503.     /* 1c000-1ffff empty */
  504.  
  505.     ROM_REGION( 0x0240, REGION_PROMS )
  506.     ROM_LOAD( "523h10.2f",    0x0000, 0x0020, 0xec15dd15 ) /* palette */
  507.     ROM_LOAD( "523h11.3f",    0x0020, 0x0020, 0x54be2e83 ) /* palette */
  508.     ROM_LOAD( "523h12.10f",   0x0040, 0x0100, 0x53166a2a ) /* sprites */
  509.     ROM_LOAD( "523h13.11f",   0x0140, 0x0100, 0x4e0647a0 ) /* characters */
  510. ROM_END
  511.  
  512.  
  513. static void init_finalizr(void)
  514. {
  515.     konami1_decode();
  516. }
  517.  
  518.  
  519. GAMEX( 1985, finalizr, 0,        finalizr, finalizr, finalizr, ROT90, "Konami", "Finalizer - Super Transformation", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL )
  520. GAMEX( 1985, finalizb, finalizr, finalizr, finalizb, finalizr, ROT90, "bootleg", "Finalizer - Super Transformation (bootleg)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL )
  521.